package com.cskaoyan.javase.oop3._1interface._5extend;

/**
 * 测试链式调用
 * @since 10:44
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Test {
    public static void main(String[] args) {
        System.out.println("hello world!");

        // 链式调用,它的前提是前面方法调用的返回值是一个对象
        new Student().getStudent().getTeacher().show();
    }
}

class Student {
    public Student getStudent() {
        return new Student();
    }
    public Teacher getTeacher() {
        return new Teacher();
    }
}

class Teacher {
    public void show() {
        System.out.println("秀一波~~~");
    }
}